package com.css.spring.formework.beans;

import com.css.spring.formework.aop.AopConfig;
import com.css.spring.formework.aop.AopProxy;
import com.css.spring.formework.core.FactoryBean;

public class BeanWrapper extends FactoryBean {
    private Object wrapperInstance;
    //css//原生
    private Object originalInstance;
    private BeanPostProcessor postProcessor;

    private AopProxy aopProxy = new AopProxy();


    public BeanPostProcessor getPostProcessor() {
        return postProcessor;
    }

    public void setPostProcessor(BeanPostProcessor postProcessor) {
        this.postProcessor = postProcessor;
    }

    public BeanWrapper() {
    }

    public BeanWrapper(Object instance) {
        this.wrapperInstance = aopProxy.getProxy(instance);
        this.originalInstance = instance;
    }

    public Object getWrapperInstance() {
        return wrapperInstance;
    }

    /**
     * 返回代理以后的类
     *
     * @return
     */
    public Class<?> getWrapperClass() {
        return wrapperInstance.getClass();
    }

    public void setAopConfig(AopConfig aopConfig) {
        aopProxy.setAopConfig(aopConfig);
    }
}
